package cn.agiledata.bank.common.service.email;

import java.util.Date;
import java.util.Map;

import cn.agiledata.bank.common.dao.ActionTypeTemplate;
import cn.agiledata.bank.common.service.NotifyMail;
import cn.agiledata.bank.common.util.DateUtil;
import cn.agiledata.bank.common.util.WeatherUtil;
import cn.agiledata.bank.hibernateBean.ScoresHis;
import cn.agiledata.bank.hibernateBean.SubAccount;
import cn.agiledata.bank.hibernateBean.Transaction;
import com.vnv.infrastructure.logic.IPBAppFactory;

public class Controversial extends NotifyMail{

	private String mobilemessage="欢迎使用支付系统";

	public String getMobilemessage() {
		return mobilemessage;
	}

	public void setMobilemessage(String mobilemessage) {
		this.mobilemessage = mobilemessage;
	}

	protected SubAccount setMailContext(Map vnvMap, Transaction tran, ScoresHis score) {
		vnvMap.put("tranId", tran.getTransId());
		String now = DateUtil.date2String(new Date());
		vnvMap.put("credit", WeatherUtil.getNameOrEmailOrMobileByAccount(tran.getCredit().getAccount()));
		vnvMap.put("debit", WeatherUtil.getNameOrEmailOrMobileByAccount(tran.getDebit().getAccount()));
		vnvMap.put("trantype", "交易");
		vnvMap.put("tranTime", now);
		vnvMap.put("transtype", "担保交易");
		vnvMap.put("shortTranId", tailOfTransId(tran.getTransId()));
		ActionTypeTemplate at = (ActionTypeTemplate) IPBAppFactory
				.getObj("actionTypeTemplate");
		String status = at.getTransStatusById(tran.getTransStatus())
				.getListName();
		vnvMap.put("transstatue", status);
		vnvMap.put("amount", tran.getAmount().toString());
		vnvMap.put("mobilemessage", getMobilemessage());
		vnvMap.put("fee", tran.getDebitFee().toString());
		double trueamount = tran.getAmount().doubleValue()
				+ tran.getDebitFee().doubleValue();
		vnvMap.put("trueamount", trueamount + "");
		
		String warn = "重要提醒：<br/>" + "为维护您的权益，请您保留与此次交易相关的所有文字数据等资料，以备核实。"
				+ "客服将于24小时以内与您取得联系，并协助您处理此次交易所产生的争议。<br/>";
		vnvMap.put("warn", warn);
		
		String titlemessage = "争议处理通知，由于卖家拒绝退款，交易进入争议处理流程 ";
		vnvMap.put("titlemessage", titlemessage);
		return tran.getDebit();
	}

}
